 <template>
  <!-- 详细内容页面 -->
  <div id="container">
    <el-collapse v-model="activeNames" v-loading="loading">
      <el-collapse-item title="基本信息" name="1">
        <follow-record-detail
          ref="detail"
          :form="followRecordData"
        ></follow-record-detail>
      </el-collapse-item>
      <!-- 2023.7.24 跟进不需要审批 -->
      <!-- <el-collapse-item title="审批流程" name="2">
        <check-process
          ref="checkProcess"
          :id="$route.query.id"
          :type="7"
          @updatePage="updatePage"
        ></check-process>
      </el-collapse-item> -->
      <el-collapse-item title="评论" name="2"
        ><comment ref="comment" :type="7"></comment>
      </el-collapse-item>
    </el-collapse>
  </div>
</template>
<script>
import followRecordDetail from './components/followRecordDetail.vue'
import comment from '@/components/comments'
import checkProcess from '@/components/checkProcess/checkList'
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'detail',
  data () {
    return {
      activeNames: ['1', '2'],
      checkCofig: [],
      loading: false,
      followRecordData: {},
      followType: []

    }
  },
  components: {
    followRecordDetail,
    comment,
    checkProcess
  },
  beforeMount () {
    this.getType()
  },
  mounted () {
    this.getDetail()
  },

  methods: {
    // 获取类型
    async getType () {
      this.followType = await queryTypeByDic('followType')
    },
    async getDetail () {
      this.loading = true
      let { data } = await this.$API.contract.followRecord.getDetailById.post({ id: this.$route.query.id })

      this.followRecordData = data
      this.followType.forEach(item => {
        if (item.value == this.followRecordData.type) {
          this.followRecordData.typeName = item.name
        }
      })
      this.$refs.comment.getCommentList()
      this.loading = false
    },
    updatePage () {
      this.getDetail()
      this.$refs.detail.relodPart()
    }
  }
}
</script>
<style lang='scss' scoped>
#container {
  height: 100%;
  margin: 10px;

  :deep(.el-collapse-item__header) {
    padding-left: 20px;
    font-size: 16px;
  }
  :deep(.el-collapse-item__content) {
    padding: 0 20px 20px 20px;
  }
  :deep(.el-form-item) {
    margin-bottom: 5px;
  }
  :deep(.el-form-item__label) {
    color: #999;
  }
}
</style>